//
//  HHPHTTPChainRequest.h
//  HHPHTTPRequest
//
//  Created by 韩红坡 on 2017/1/16.
//  Copyright © 2017年 韩红坡. All rights reserved.
//
//  使用方式如下：
//
//    HHPHTTPChainRequest *chainRequest = [HHPHTTPChainRequest alloc] init];
//    [chainRequest addRequestBlock:^HHPHTTPRequest *(HHPHTTPRequest *previousRequest) {
//        HHPHTTPRequest *request = [[HHPHTTPRequestManager manager] createRequest];
//        return request;
//    }];
//    [chainRequest addRequestBlock:^HHPHTTPRequest *(HHPHTTPRequest *previousRequest) {
//        NSString *result = previousRequest.data;
//        HHPHTTPRequest *request = [[HHPHTTPRequestManager manager] createRequest];
//        [request setParam:@"userId" value:result];
//        return request;
//    }];
//    [chainRequest startWithSuccess:^(HHPHTTPChainRequest *chainRequest) {
//        
//    } error:^(HHPHTTPChainRequest *chainRequest) {
//        
//    }];


#import <Foundation/Foundation.h>

@class HHPHTTPRequest;

@interface HHPHTTPChainRequest : NSObject

@property (nonatomic, strong, readonly) NSArray<HHPHTTPRequest *> *requests;

- (void)addRequestBlock:(HHPHTTPRequest *(^)(HHPHTTPRequest *previousRequest))requestBlock;

- (void)startWithSuccess:(void (^)(HHPHTTPChainRequest *chainRequest))successBlock
                   error:(void (^)(HHPHTTPChainRequest *chainRequest))errorBlock;

- (void)cancel;

@end
